import React from 'react'
import { getMovieListAction } from '../../store/actions/movieListAction';
import store from '../../store/store'

export default function Movie() {
  const { count } = store.getState().count
  const { movieList } = store.getState().movie
  const getMovieListHandle = () => {
    store.dispatch(getMovieListAction())
  }

  // console.log(movieList, 'movieList');
  // console.log(store.getState().movie, 'store.getState().movie ');

  return (
    <div>
      <h1>我是Movie组件</h1>
      <p>我收到的Count组件的值是 {count}</p>
      <button onClick={getMovieListHandle}>获取电影的数据</button>
      {
        movieList.map(item => {
          return <li key={item.tvId}>{item.name}</li>
        })
      }
    </div>
  )
}
